#include "Clique.h"

Clique::Clique()
{
  vertices = list<int>();
}

void Clique::agregarVertice(int v)
{
  vertices.push_back(v);
}

void Clique::agregarVertices(list<int>& vs)
{
  for (list<int>::iterator it = vs.begin(); it != vs.end(); it++)
  {
    vertices.push_back(*it);
  }
}

ostream& operator<<(ostream& os, Clique& c)
{
  os << '{';
  for (list<int>::iterator it = c.vertices.begin(); it != c.vertices.end();
    it++)
  {
  	os << *it;
  	list<int>::iterator jt(it);
  	jt++;
  	if (jt != c.vertices.end())
  	{
  	  os << ' ';
  	}
  }
  os << '}';
  return os;
}

Cliques::Cliques(int cantidadNodos)
{
  cantNodos = cantidadNodos;
  cliquesDeNodo = new Clique[cantNodos];
  listaCliquesYPadres = list< pair<Clique, Clique> >();
}

void Cliques::agregarClique(Clique& c, int vertice, Clique& padre)
{
  cliquesDeNodo[vertice] = c;
  listaCliquesYPadres.push_back(pair<Clique, Clique>(c, padre));
}

Clique& Cliques::obtenerClique(int vertice)
{
  return cliquesDeNodo[vertice];
}

void Cliques::establecerClique(int x, Clique& c)
{
  cliquesDeNodo[x] = c;
}
